<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * Class CreateCartsTable.
 */
class CreateCartsTable extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('carts', function(Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户id');
            $table->integer('shop_id')->comment('商铺id');
            $table->integer('product_id')->comment('商铺id');
            $table->integer('sku_id')->comment('商铺id');
            $table->integer('num')->default(1)->comment('商铺id');
            $table->tinyInteger('status')->default(1)->comment('商品是否有效, 1:有效，0:无效');
            $table->tinyInteger('type')->default(1)->comment('购物车类型：1商品；2库品');
            $table->softDeletes();
            $table->timestamps();
            $table->index('user_id');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('carts');
	}
}
